//
//  AEHistoryPointsTopView.m
//  AESOLAR_IOS
//
//  Created by Bin Tang on 2024/10/15.
//  Copyright © 2024 Mr.Wang. All rights reserved.
//

#import "AEHistoryPointsTopView.h"
#import "AE_Solar-Swift.h"

@interface AEHistoryPointsTopView ()

@property (nonatomic, strong) UILabel *titleLabel;

/// 积分
@property (nonatomic, strong) UILabel *cntLabel;

@end

@implementation AEHistoryPointsTopView

- (void)initWithSubView {
    self.backgroundColor = kThemeColor;
}

- (void)initWithTitleLabel {
    if (!_titleLabel) {
        NSString *title = [AEStringExten localizedValueWithKey:@"当前积分"];
        UIFont *font = [UIFont systemFontOfSize:24 weight:UIFontWeightBold];
        float width = [title widthForFont:font] + 2;
        CGRect frame = CGRectMake(15, (self.height - 40) * 0.5, width, 40);
        _titleLabel = [UILabel createWithLabel:self frame:frame font:font propertiesBlock:^(UILabel * _Nonnull label) {
            label.textColor = [UIColor colorWithHexString:@"#ffffff"];
            label.text = title;
        }];
    }
}

- (void)initWithCntLabel {
    if (!_cntLabel) {
        UIFont *font = [UIFont systemFontOfSize:24 weight:UIFontWeightBold];
        CGRect frame = self.titleLabel.frame;
        frame.origin.x = self.titleLabel.right + 30;
        frame.size.width = self.width - self.titleLabel.right - 30 - 15;
        _cntLabel = [UILabel createWithLabel:self frame:frame font:font propertiesBlock:^(UILabel * _Nonnull label) {
            label.textColor = [UIColor colorWithHexString:@"#ffffff"];
        }];
    }
    self.cntLabel.text = @"899";
}

- (void)updateWithViewData:(id)data {
    
    
    [self initWithTitleLabel];
    
    [self initWithCntLabel];
}

@end
